package edu.udel.mboch.towerdefense;

public class TowerDefenseGameRecord implements Comparable<TowerDefenseGameRecord>
{
	private String player;
	private Integer wave;
	private Integer cash;
	private Integer lives;
	private Long date;
	
	public TowerDefenseGameRecord(String player, Integer wave, Integer cash, Integer lives, Long date)
	{
		this.player = player;
		this.wave = wave;
		this.cash = cash;
		this.lives = lives;
		this.date = date;
	}

	public String getPlayer()
	{
		return player;
	}

	public void setPlayer(String player)
	{
		this.player = player;
	}

	public Integer getWave()
	{
		return wave;
	}

	public void setWave(Integer wave)
	{
		this.wave = wave;
	}

	public Integer getCash()
	{
		return cash;
	}

	public void setCash(Integer cash)
	{
		this.cash = cash;
	}

	public Integer getLives()
	{
		return lives;
	}

	public void setLives(Integer lives)
	{
		this.lives = lives;
	}

	public Long getDate()
	{
		return date;
	}

	public void setDate(Long date)
	{
		this.date = date;
	}
	
	public int compareTo(TowerDefenseGameRecord record)
	{
		if(wave.intValue() > record.getWave().intValue())
			return 1;
		else if(wave.intValue() < record.getWave().intValue())
			return -1;
		else
		{
			if(lives.intValue() > record.getLives().intValue())
				return 1;
			else if(lives.intValue() < record.getLives().intValue())
				return -1;
			else
			{
				if(cash.intValue() > record.getCash().intValue())
					return 1;
				else if(cash.intValue() < record.getCash().intValue())
					return -1;
				else
				{
					if(player.compareTo(record.getPlayer()) > 0)
						return -1;
					else if(player.compareTo(record.getPlayer()) < 0)
						return 1;
					else
					{
						if(date.longValue() > record.getDate().longValue())
							return 1;
						else if(date.longValue() < record.getDate().longValue())
							return -1;
						else
							return 0;
					}
				}
			}
		}
	}
}
